package com.spring.gll.single;

public class SafeSingle {
    private static SafeSingle safeSingle;
    public static SafeSingle getSafeSingle(){
        if(safeSingle==null){
            synchronized (SafeSingle.class){
                if(safeSingle==null){
                    safeSingle=new SafeSingle();
                }
            }
        }
        return safeSingle;
    }

    public static void main(String[] args) {
        SafeSingle ss1 = SafeSingle.getSafeSingle();
        SafeSingle ss2 = SafeSingle.getSafeSingle();
        System.out.println(ss1);
        System.out.println(ss2);
    }
}
